﻿
/// <reference path="Nana-vsdoc.js" />

/*!
// A part of "Nana Script Utilities", accept the license at http://nana.codeplex.com/license before use it in your own products.
// 这是《Nana脚本工具箱》的一部分，在您自己的产品中使用以前先接受这个使用许可：http://nana.codeplex.com/license
*/

// 以下是在HTML中的推荐使用方式
//========//========
//  <script type="text/ecmascript" src="Nana.Html.js"></script>
//  <script type="text/ecmascript">
//    this.Nana && document.write('<\!--');
//  </script>
//  <script type="text/ecmascript" src="Nana.Html.js?"><\/script>
//  <!-- -->
//  <script type="text/ecmascript">
//    if(!window.Nana)
//      try { Nana } catch(ex) { alert(ex.message || ex.description) }
//    else {
//      // 从这里开始进行其它操作
//    } 
//  </script>
//========//========

window.Nana || function () {
  window.$nanaInitialized || ($nanaInitialized = function () {
    var undefined, Html = Nana.parseNS("Nana.Html");

    if (window.__defineGetter__) {
      if (window.event === undefined)
        __defineGetter__("event", function () {
          return arguments.callee.caller.arguments[0];
        });

      if (window.__defineSetter__) {
        if (window.Element)
          Element.prototype.__defineSetter__("innerText", function (value) {
            this.textContent = value;
          }), Element.prototype.__defineGetter__("innerText", function () {
            return this.textContent;
          });
      }
    }

    function StorageManagerBase() {
      /// <summary>本地存储管理器的基类，不包含实际的实现。</summary>
      /// <returns type="StorageManagerBase" />

      if (!StorageManagerBase.canConstruct(this))
        return StorageManagerBase.newFormal();

      Nana.Object.call(this);

    }
    (StorageManagerBase.prototype = new Nana.Object()).constructor = Nana.Html.StorageManagerBase = StorageManagerBase;

  });

  //========//========

  var base = window.$nanaLibBase, suffix = window.$nanaLibSuffix;
  base || function () {
    var c = document.getElementsByTagName("script");
    var rx = /^([\s\S]*)Nana\.Html([\s\S]*)$/, m, i = c.length;
    while (i-- > 0) {
      if (m = rx.exec(c[i].src))
        return base = m[1], suffix = m[2];
    }
  } ();

  document.write('<script type="text/ecmascript" src="' + base + "Nana" + suffix + '"></script>');
} ();
